package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum Language {
	
	zh_CN(0),
	zh_TW(1),
	en(2);
	
	private Integer value;
	
	private Language(Integer value){
		this.value = value;
	}

	public int toIntValue() {
		return this.value;
	}

	public static Language toValue(int value) {
		if (zh_CN.value == value) {
			return zh_CN;
		} else if (zh_TW.value == value) {
			return zh_TW;
		} else if(en.value == value){
			return en;
		}else {
			throw new InvalidArgumentException("Unknown Language[" + value + "].");
		}
	}
}
